package alik.notes.server.persistence;

import java.util.ArrayList;
import java.util.List;

import alik.notes.shared.data.Note;
import alik.notes.shared.data.NoteBean;

public class PersistenceTransformer {
	public static NotePersistable transform(final Note note) {
		return new NotePersistable(note.getTitle(), note.getDescription(), note.getLastEditDate());
	}

	public static Note transform(final NotePersistable note) {
		return new NoteBean(note.getTitle(), note.getDescription(), note.getLastEditDate());
	}

	public static List<Note> transform(final List<NotePersistable> persistableNotes) {
		ArrayList<Note> notes = new ArrayList<Note>();
		for (NotePersistable notePersistable : persistableNotes) {
			notes.add(transform(notePersistable));
		}
		return notes;
	}
}
